package com.doge.calcalbum.core.base

import androidx.annotation.MainThread
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelLazy
import com.doge.calcalbum.App
import com.doge.calcalbum.utils.appContext

@MainThread
inline fun <reified VM : ViewModel> appViewModels(): Lazy<VM> {
    return ViewModelLazy(
        VM::class,
        { (appContext as App).viewModelStore },
        { (appContext as App).getViewModelFactory() }
    )
}